<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 2.3.1
Version: 1.1.2
Author: KeenThemes
Website: http://www.keenthemes.com/preview/?theme=metronic
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469
-->
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8" />
    <title>A2Z Solution | Quản trị website</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/css/metro.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/css/style.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/css/style_responsive.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/css/style_default.css" rel="stylesheet" id="style_color" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/gritter/css/jquery.gritter.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/uniform/css/uniform.default.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap-daterangepicker/daterangepicker.css" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/fullcalendar/fullcalendar/bootstrap-fullcalendar.css" rel="stylesheet" />
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/jqvmap.css" media="screen" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="fixed-top">
<?php
$sort = 'ordering_date desc';

$criteria = new CDbCriteria();
$criteria->order = $sort;


$item_count = Order::model()->with(array('status'=>1))->count($criteria);

$newOrders = Order::model()->with(array('status'=>1))->findAll($criteria);

$sortContact = 'created_time desc';
$criteriaContact = new CDbCriteria();
$criteriaContact->order = $sortContact;


$itemCountContact = Contact::model()->count($criteriaContact);

$newContacts = Contact::model()->findAll()
?>

<!-- BEGIN HEADER -->
<div class="header navbar navbar-inverse navbar-fixed-top">
    <!-- BEGIN TOP NAVIGATION BAR -->
    <div class="navbar-inner">
        <div class="container-fluid">
            <!-- BEGIN LOGO -->
            <a class="brand" href="/admin">
                <img src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/img/logo.png" alt="logo" />
            </a>
            <!-- END LOGO -->
            <!-- BEGIN RESPONSIVE MENU TOGGLER -->
            <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">
                <img src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/img/menu-toggler.png" alt="" />
            </a>
            <!-- END RESPONSIVE MENU TOGGLER -->
            <!-- BEGIN TOP NAVIGATION MENU -->
            <ul class="nav pull-right">
                <!-- BEGIN NOTIFICATION DROPDOWN -->
                <li class="dropdown" id="header_notification_bar">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="icon-tasks"></i>
                        <span class="badge"><?=$item_count?></span>
                    </a>
                    <ul class="dropdown-menu extended notification">
                        <li>
                            <p>Bạn có <?=$item_count?> đơn hàng mới</p>
                        </li>
                        <?php foreach($newOrders as $key =>$order) {?>
                        <li>
                            <a href="<?php  echo $this->createUrl('/admin/order/admin'); ?>">
                                <span class="label label-success"></span>
                                Đơn hàng mới.
                                <span class="time">ngày <?=date("d/m/Y", strtotime($order['ordering_date']))?></span>
                            </a>
                        </li>
                        <?php } ?>
                        <li class="external">
                            <a href="<?php  echo $this->createUrl('/admin/order/admin'); ?>">Xem tất cả đơn hàng <i class="m-icon-swapright"></i></a>
                        </li>
                    </ul>
                </li>
                <!-- END NOTIFICATION DROPDOWN -->
                <!-- BEGIN INBOX DROPDOWN -->
                <li class="dropdown" id="header_inbox_bar">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="icon-envelope-alt"></i>
                        <span class="badge"><?=$itemCountContact?></span>
                    </a>
                    <ul class="dropdown-menu extended inbox">
                        <li>
                            <p>Bạn có <?=$itemCountContact?> liên hệ</p>
                        </li>
                        <?php foreach($newContacts as $key =>$contact) {?>
                        <li>
                            <a href="<?php  echo $this->createUrl('/admin/contact/index'); ?>">
                                <span class="photo"><img src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/img/avatar2.jpg" alt="" /></span>
								<span class="subject">
								<span class="from"><?=$contact['name']?></span>
								</span>
								<span class="message">
								<?=(strlen($contact['message'])>20)?substr($contact['message'],20).'...':$contact['message']?>
								</span>
                            </a>
                        </li>
                        <?php } ?>
                        <li class="external">
                            <a href="<?php  echo $this->createUrl('/admin/contact/index'); ?>">Xem tất cả liên hệ <i class="m-icon-swapright"></i></a>
                        </li>
                    </ul>
                </li>
                <!-- END INBOX DROPDOWN -->
                <!-- BEGIN USER LOGIN DROPDOWN -->
                <li class="dropdown user">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <!--<img alt="" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/img/avatar1_small.jpg" />-->
                        <span class="username"><?php echo Yii::app()->user->name;?></span>
                        <i class="icon-angle-down"></i>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="/admin/users/view/id/<?php echo Yii::app()->user->id;?>"><i class="icon-user"></i> Hồ sơ</a></li>
                        <li class="divider"></li>
                        <li><a href="<?php  echo $this->createUrl('/admin/users/logout'); ?>"><i class="icon-key"></i> Đăng xuất</a></li>
                    </ul>
                </li>
                <!-- END USER LOGIN DROPDOWN -->
            </ul>
            <!-- END TOP NAVIGATION MENU -->
        </div>
    </div>
    <!-- END TOP NAVIGATION BAR -->
</div>
<!-- END HEADER -->
<!-- BEGIN CONTAINER -->
<div class="page-container row-fluid">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar nav-collapse collapse">
    <!-- BEGIN SIDEBAR MENU -->
    <ul>
        <li>
            <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
            <div class="sidebar-toggler"></div>
            <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
        </li>
        <li>
            <!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
            <form class="sidebar-search">
                <div class="input-box">
                    <a href="javascript:;" class="remove"></a>
                    <input type="text" placeholder="Tìm kiếm..." />
                    <input type="button" class="submit" value=" " />
                </div>
            </form>
            <!-- END RESPONSIVE QUICK SEARCH FORM -->
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='shop') echo 'class="active"';?> ">
            <a href="<?php echo $this->createUrl('/admin/shop/admin'); ?>">
                <i class="icon-home"></i>
                <span class="title">Trang chủ</span>
                <span class="selected"></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='customer') echo 'active';?>">
            <a href="/admin/customer/admin">
                <i class="icon-group"></i>
                <span class="title">Khách hàng</span>
                <span class="arrow "></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='frame') echo 'active';?>">
            <a href="/admin/frame/admin">
                <i class="icon-picture"></i>
                <span class="title">Khung ảnh</span>
                <span class="arrow "></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='products') echo 'active';?>">
            <a href="/admin/products/admin">
                <i class="icon-th-list"></i>
                <span class="title">Sản phẩm</span>
                <span class="arrow "></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='category' || Yii::app()->controller->id=='subcategory') echo 'active';?>">
            <a href="javascript:;">
                <i class="icon-bookmark-empty"></i>
                <span class="title">Menu sản phẩm</span>
                <span class="arrow "></span>
            </a>
            <ul class="sub">
                <li <?php if(Yii::app()->controller->id=='category' && Yii::app()->controller->action->id=='admin') echo 'class="active"';?>><a href="/admin/category/admin">Danh mục menu</a></li>
                <li <?php if(Yii::app()->controller->id=='subcategory' && Yii::app()->controller->action->id=='admin') echo 'class="active"';?>><a href="/admin/subcategory/create">Danh mục Sub menu</a></li>
            </ul>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='order') echo 'active';?>">
            <a href="/admin/order/admin">
                <i class="icon-money"></i>
                <span class="title">Đơn hàng</span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='shippingcountry') echo 'active';?>">
            <a href="<?php echo $this->createUrl('shippingcountry/admin'); ?>">
                <i class="icon-money"></i>
                <span class="title">Shipping</span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='news') echo 'active';?>">
            <a href="<?php echo $this->createUrl('news/index'); ?>">
                <i class="icon-book"></i>
                <span class="title">Tin tức</span>
                <span class="arrow "></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='contact') echo 'active';?>">
            <a href="javascript:;">
                <i class="icon-envelope"></i>
                <span class="title">Liên hệ</span>
                <span class="arrow "></span>
            </a>
            <ul class="sub">
                <li <?php if(Yii::app()->controller->id=='company' && Yii::app()->controller->action->id=='update') echo 'class="active"';?>><a href="/admin/company/update/id/1">Thông tin C.ty</a></li>
                <li <?php if(Yii::app()->controller->id=='contact' && Yii::app()->controller->action->id=='admin') echo 'class="active"';?>><a href="/admin/contact/admin">Khách hàng liên hệ</a></li>
            </ul>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='faq') echo 'active';?>">
            <a href="<?php echo $this->createUrl('faq/index'); ?>">
                <i class="icon-envelope"></i>
                <span class="title">FAQ</span>
                <span class="arrow "></span>
            </a>
        </li>
        <li class="has-sub <?php if(Yii::app()->controller->id=='users') echo 'active';?>">
            <a href="<?php echo $this->createUrl('users/index'); ?>">
                <i class="icon-key"></i>
                <span class="title">Thành viên quản trị</span>
                <span class="arrow "></span>
            </a>
            <ul class="sub">
                <li <?php if(Yii::app()->controller->id=='users' && Yii::app()->controller->action->id=='index') echo 'class="active"';?>><a href="<?php echo $this->createUrl('users/index'); ?>">Danh mục thành viên</a></li>

            </ul>
        </li>
        <li>
            <a target="_blank" href="<?php echo Yii::app()->request->baseUrl .'/'; ?>">
                <i class="icon-globe"></i>
                <span class="title">Xem trang chủ PetitPoint</span>
            </a>
        </li>
    </ul>
    <!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN PAGE -->
<div class="page-content">

    <?php echo $content; ?>
    <!-- END PAGE CONTAINER-->
</div>
<!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="footer">
    2014 &copy; <a href="http://www.a2zsolution.vn" target="_blank" style="color:#999999">A2Z Solution</a>.
    <div class="span pull-right">
        <span class="go-top"><i class="icon-angle-up"></i></span>
    </div>
</div>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS -->
<!-- Load javascripts at bottom, this will reduce page load time -->
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/jquery-1.8.3.min.js"></script>
<!--[if lt IE 9]>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/excanvas.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/respond.js"></script>
<![endif]-->
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/breakpoints/breakpoints.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jquery-ui/jquery-ui-1.10.1.custom.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/fullcalendar/fullcalendar/fullcalendar.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/fancybox/source/jquery.fancybox.pack.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/jquery.blockui.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/jquery.cookie.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/jquery.vmap.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/maps/jquery.vmap.russia.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/maps/jquery.vmap.world.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/maps/jquery.vmap.europe.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/maps/jquery.vmap.germany.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/maps/jquery.vmap.usa.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/jqvmap/jqvmap/data/jquery.vmap.sampledata.js" type="text/javascript"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/flot/jquery.flot.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/flot/jquery.flot.resize.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/uniform/jquery.uniform.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/jquery.pulsate.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap-daterangepicker/date.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/libs/assets/js/app.js"></script>
<script src="<?php echo Yii::app()->baseUrl.'/libs/assets/all-scripts.js'; ?>"></script>
<script src="<?php echo Yii::app()->baseUrl.'/libs/ckeditor/ckeditor.js'; ?>"></script>
<script type="text/javascript">
    jQuery(document).ready(function() {
        App.setPage("index");  // set current page
        App.init(); // init the rest of plugins and elements
    });
</script>
<script type="text/javascript">
    CKEDITOR.replace( 'ckeditor' );
    CKEDITOR.replace( 'News[description]' );
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>
